import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/base/const_color.dart';
import 'package:flutter_app/base/normal_widget.dart';

class FirstWidget extends StatefulWidget {
  @override
  _FirstWidgetState createState() => _FirstWidgetState();
}

class _FirstWidgetState extends State<FirstWidget> {


  @override
  void initState() {
    // TODO: implement initState
    super.initState();

  }

  @override
  Widget build(BuildContext context) {
    return ScrollConfiguration(
      behavior: NullOverScrollBehavior(),
      child: ListView.builder(
        itemBuilder: (context,i){
          int position = i % 10 + 1 ;
          return i == 0 ?
          computerLogin() :
          Container(
            color: Colors.white,
            child: Row(
              children: <Widget>[
                Stack(
                  alignment: Alignment.topRight,
                  children: <Widget>[
                    Container(
                      padding: EdgeInsets.fromLTRB(15, 10, 10, 10),
                      child: ClipRRect(
                        borderRadius: BorderRadius.all(Radius.circular(5)),
                        child: Image.asset("images/user"+position.toString()+".jpeg",width: 50,height: 50,fit: BoxFit.cover,),
                      ),
                    ),
                    RedCircleCount(
                      count: i,
                    ),
                  ],
                ),
                Expanded(
                  child: Container(
                    height: 60,
                    decoration: BoxDecoration(
                        border: Border(bottom: BorderSide(color: lineColor,width: 0.5))
                    ),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: <Widget>[
                        Expanded(
                          child: Container(
                            height: 60,
                            child: Column(
                              mainAxisAlignment: MainAxisAlignment.center,
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: <Widget>[
                                Container(
                                  margin: EdgeInsets.only(bottom: 6),
                                  child: Text("我曾难自拔于世界之大",style: TextStyle(fontSize: 14,fontWeight: FontWeight.bold,color: Colors.black87),maxLines: 1,overflow: TextOverflow.ellipsis,),
                                ),
                                Text("我曾难自拔于世界之大",style: TextStyle(fontSize: 12,color: Colors.grey[400]),maxLines: 1,overflow: TextOverflow.ellipsis,),
                              ],
                            ),
                          ),
                        ),
                        Text("下午3:05",style: TextStyle(fontSize: 12,color: Colors.grey[300]),maxLines: 1,overflow: TextOverflow.ellipsis,),
                      ],
                    ),
                  ),
                ),
              ],
            ),
          );
        },
        itemCount: 0,
      ),
    );
  }

  Widget computerLogin(){
    return Column(
      mainAxisSize: MainAxisSize.min,
      crossAxisAlignment: CrossAxisAlignment.stretch,
      children: <Widget>[
        Container(
          width: 0.5,
          color: Colors.grey[350],
        ),
        Container(
          height: 45,
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Icon(Icons.computer,color: Colors.black45,),
              Container(
                padding: EdgeInsets.only(left: 20),
                alignment: Alignment.centerLeft,
                child: Text("Windows微信已登录，手机通知已关闭",style: TextStyle(color: Colors.black45,fontSize: 13),maxLines: 1,),
              )
            ],
          ),
        ),
        Container(
          width: 0.5,
          color: lineColor,
        ),
      ],
    );
  }


}
